<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>MISSQUAR Store</title>
  <style>
    body {
      margin: 0;
      font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
      background-color: #000;
      color: #fff;
    }
    header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      padding: 20px 40px;
      border-bottom: 1px solid #333;
    }
    header h1 {
      font-size: 20px;
      letter-spacing: 2px;
    }
    nav a {
      margin-left: 20px;
      text-decoration: none;
      color: #fff;
      font-size: 14px;
    }
    .container {
      padding: 40px;
      display: grid;
      grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
      gap: 30px;
    }
    .product {
      background: #111;
      padding: 20px;
      border-radius: 10px;
      text-align: center;
    }
    .product img {
      width: 100%;
      border-radius: 10px;
    }
    .product h2 {
      margin: 15px 0 10px;
      font-size: 18px;
    }
    .product button {
      background: #fff;
      color: #000;
      border: none;
      padding: 10px 20px;
      border-radius: 20px;
      cursor: pointer;
      font-weight: bold;
      transition: 0.3s;
    }
    .product button:hover {
      background: #aaa;
    }
    #cart {
      position: fixed;
      right: 20px;
      top: 80px;
      background: #111;
      padding: 20px;
      border-radius: 10px;
      width: 250px;
    }
    #cart h2 {
      font-size: 16px;
      margin-bottom: 10px;
    }
    #cart ul {
      list-style: none;
      padding: 0;
      font-size: 14px;
    }
    #cart ul li {
      margin-bottom: 8px;
    }
    #reviews {
      padding: 40px;
      background: #111;
      margin: 40px;
      border-radius: 10px;
    }
    #reviews h2 {
      margin-bottom: 20px;
    }
    #reviews input, #reviews button {
      padding: 10px;
      margin-top: 10px;
      border-radius: 5px;
      border: none;
    }
    #reviews button {
      background: #fff;
      color: #000;
      cursor: pointer;
      font-weight: bold;
    }
  </style>
</head>
<body>

  <header>
    <h1>MISSQUAR</h1>
    <nav>
      <a href="#">首页</a>
      <a href="#">商店</a>
      <a href="#">联系我们</a>
    </nav>
  </header>

  <div class="container">
    <div class="product">
      <img src="https://via.placeholder.com/300x200?text=Product+1" alt="Product">
      <h2>高端手机壳</h2>
      <p>¥199</p>
      <button onclick="addToCart('高端手机壳',199)">加入购物车</button>
    </div>
    <div class="product">
      <img src="https://via.placeholder.com/300x200?text=Product+2" alt="Product">
      <h2>时尚耳机</h2>
      <p>¥899</p>
      <button onclick="addToCart('时尚耳机',899)">加入购物车</button>
    </div>
  </div>

  <div id="cart">
    <h2>🛒 购物车</h2>
    <ul id="cart-items"></ul>
    <p id="cart-total">合计: ¥0</p>
  </div>

  <div id="reviews">
    <h2>用户评价</h2>
    <div id="review-list"></div>
    <input type="text" id="review-input" placeholder="写下你的评价...">
    <button onclick="addReview()">提交评价</button>
  </div>

  <script>
    let cart = [];
    function addToCart(product, price) {
      cart.push({product, price});
      updateCart();
    }
    function updateCart() {
      const cartItems = document.getElementById('cart-items');
      const total = document.getElementById('cart-total');
      cartItems.innerHTML = '';
      let sum = 0;
      cart.forEach(item => {
        let li = document.createElement('li');
        li.textContent = item.product + ' - ¥' + item.price;
        cartItems.appendChild(li);
        sum += item.price;
      });
      total.textContent = '合计: ¥' + sum;
    }
    function addReview() {
      const input = document.getElementById('review-input');
      const list = document.getElementById('review-list');
      if(input.value.trim() !== '') {
        let p = document.createElement('p');
        p.textContent = "⭐ " + input.value;
        list.appendChild(p);
        input.value = '';
      }
    }
  </script>

</body>
</html>
